import java.io.FileReader;
import java.io.IOException;
import java.io.Reader;

public class IODemo12 {
    public static void main1(String[] args) {
        try(Reader reader = new FileReader("./aaa/222/test.txt")){
            while(true){
                int res = reader.read();
                if(res == -1){
                    break;
                }
                System.out.print((char)res + " ");
            }
        } catch (IOException e) {
            e.printStackTrace();
        }
    }

    public static void main(String[] args) {
        try(Reader reader = new FileReader("./aaa/222/test.txt")){
           while (true){
               char[] buffer = new char[4];
               int res = reader.read(buffer);
               if(res == -1){
                   break;
               }
               for (int i = 0; i < res; i++) {
                   System.out.print(buffer[i]);
               }
           }
        }catch (IOException e){
            e.printStackTrace();
        }
    }
}
